package com.fenghongzhang.day005test2.view;

import android.os.Bundle;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.fenghongzhang.day005test2.R;
import com.fenghongzhang.day005test2.adapter.MyFragmentAdapter;
import com.fenghongzhang.day005test2.entity.User;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity implements RegisterFragment.MyListener {

    @BindView(R.id.vp)
    ViewPager vp;

    private static final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       ButterKnife.bind(this);


        ArrayList<Fragment> list = new ArrayList<>();
        RegisterFragment registerFragment = new RegisterFragment();
        RegisterFragment registerFragment2 = new RegisterFragment();
        list.add(registerFragment);
        list.add(registerFragment2);

        MyFragmentAdapter myFragmentAdapter = new MyFragmentAdapter(getSupportFragmentManager(), list);

        vp.setAdapter(myFragmentAdapter);


    }

    @Override
    public void click(int i) {
        vp.setCurrentItem(i);
    }



}
